<template>
  <view>
    <cu-custom
      :bgColor="globalData.bgColor"
      :isBack="true"
      :title="title ? title : $t('agreement.index.0yy120')">
    </cu-custom>
    <view class="padding-xs">
      <view
        class="margin-top-sm text-lg"
        style="line-height: 2em">
        <view v-html="contentDesc" />
      </view>
      <view v-if="!loadmore && !contentDesc">
        <view class="text-center text-gray">{{ $t("home.shop-home.dr6s84") }}</view>
      </view>
      <view :class="'cu-load ' + (loadmore ? 'loading' : 'over')"></view>
    </view>
  </view>
</template>

<script>
/**
 * Copyright (C) 2024
 * All rights reserved, Designed By www.joolun.com
 * 注意：
 * 本软件为www.joolun.com开发研制，未经购买不得使用
 * 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
 * 一经发现盗用、分享等行为，将追究法律责任，后果自负
 */

import { getObjByType } from "@/api/upms/agreementconfig";
export default {
  data() {
    return {
      globalData: getApp().globalData,
      title: "",
      type: "", // 1 租户充值协议 3 用户协议 4 隐私协议
      agreementInfo: {},
      contentDesc: "",
      loadmore: true,
    };
  },
  onLoad(options) {
    this.type = options.type;
    if (this.type == 3) {
      this.title = this.$t("login.login.uh6spk");
    } else if (this.type == 4) {
      this.title = this.$t("login.login.4e43cd");
    }
    this.agreementGet();
  },

  methods: {
    agreementGet() {
      getObjByType(this.type).then((res) => {
        this.agreementInfo = res.data || {};
        setTimeout(() => {
          this.contentDesc = this.agreementInfo.agreementContent;
          this.loadmore = false;
        }, 100);
      });
    },
  },
};
</script>

<style></style>
